package qianfeng.com.meijiadaka.adapter;

import android.os.AsyncTask;
import android.support.v7.widget.RecyclerView;

import qianfeng.com.meijiadaka.myview.MyLiveRecycleView;


/**
 * Created by Think on 2016/12/25.
 */
public class FinishRefresh extends AsyncTask<Void,Void,Void> {

    private MyLiveRecycleView rv;
    private RecyclerView.Adapter adapter;

    public FinishRefresh(MyLiveRecycleView rv, RecyclerView.Adapter adapter) {
        this.rv = rv;
        this.adapter = adapter;
    }

    @Override
    protected Void doInBackground(Void... params) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    protected void onPostExecute(Void aVoid) {
        super.onPostExecute(aVoid);
        rv.onRefreshComplete();
        adapter.notifyDataSetChanged();
    }
}
